package lambda;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class LambdaDemo1 {
    public static void main(String[] args) {
//        Comparator<String> c1 = (String s1, String s2) ->{
//            return s1.length()-s2.length();
//        };
//
//        Comparator<String> c2 = (s1, s2) -> s2.length() - s1.length();

        List<String> list = new ArrayList<>();
        list.add("王克晶");
        list.add("伟超老师");
        list.add("传奇");
        Collections.sort(list, (o1, o2) -> o1.length() - o2.length());
        System.out.println(list);
    }
}
